﻿using StudentLive.DataModel;
using StudentLive.DataModel.HubGroups;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;

namespace StudentLive
{
    public class SearchItemSelector : DataTemplateSelector
    {
        public DataTemplate Resource { get; set; }
        public DataTemplate Unit { get; set; }
        public DataTemplate LessonPlan { get; set; }
        public DataTemplate Teacher { get; set; }
        public DataTemplate Student { get; set; }


        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            DataItem dataItem = item as DataItem;

            if (dataItem.GetType() == typeof(UnitItem))
            {
                return Unit;
            }
            else if (dataItem.GetType() == typeof(LessonPlanItem))
            {
                return LessonPlan;
            }
            else if (dataItem.GetType() == typeof(ResourceItem))
            {
                return Resource;
            }

            else if (dataItem.GetType() == typeof(TeacherItem))
            {
                return Teacher;
            }

            else if (dataItem.GetType() == typeof(StudentItem))
            {
                return Student;
            }
            else
            {
                return null;
            }

        }

    }
}
